package com.mowh.gof23.creational.patterns.factory.method.idcard;

import com.mowh.gof23.creational.patterns.factory.method.framework.Product;
import com.mowh.gof23.creational.patterns.factory.method.framework.Factory;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mowh1gd
 * @create 2023/10/20 15:09
 */
public class IDCardFactory extends Factory {
    private List owners = new ArrayList();
    @Override
    protected Product createProduct(String owner) {
        return new IDCard(owner);
    }

    @Override
    protected void registerProduct(Product product) {
        owners.add(((IDCard)product).getOwner());
    }

    public List getOwners() {
        return owners;
    }
}
